package com.snail.readyvr.activity;

import android.Manifest;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.snail.readyvr.R;
import com.snail.readyvr.ui.CommonTopBar;
import com.snail.readyvr.util.AppUtils;
import com.snail.readyvr.util.StartActivityUtils;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by MRKING on 2017/1/17.
 */

public class AboutActivity extends CheckPermissionsActivity implements CommonTopBar.OnClickCommonTopBar {
    @BindView(R.id.about_top_bar)
    CommonTopBar mAboutTopBar;
    @BindView(R.id.about_app_version)
    TextView mAboutAppVersion;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        needPermissions = new String[]{
                Manifest.permission.READ_PHONE_STATE,
                Manifest.permission.WRITE_EXTERNAL_STORAGE,
                Manifest.permission.READ_EXTERNAL_STORAGE,
                Manifest.permission.CALL_PHONE};
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void hasGetAllPermissions() {

    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_about;
    }

    @Override
    protected void init() {
        mAboutTopBar.setOnClickCommonTopBar(this);
        mAboutTopBar.midTextView.setText(R.string.settings_about);
        mAboutAppVersion.setText(getString(R.string.app_name) + " " + AppUtils.getVersionName(this));
    }


    @OnClick({R.id.about_user_protocol, R.id.about_phone_layout})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.about_user_protocol:
                StartActivityUtils.startUserAgreementActivity(AboutActivity.this);
                break;
            case R.id.about_phone_layout:
               /* Intent intent = new Intent(Intent.ACTION_DIAL);
                Uri data = Uri.parse("tel:" + getString(R.string.about_user_phone_num));
                intent.setData(data);
                startActivity(intent);*/
                break;
        }
    }

    @Override
    public void onClickLeftView() {
        finish();
    }

    @Override
    public void onClickRightView() {

    }

    @Override
    public void finish() {
        super.finish();
        overridePendingTransition(0, R.anim.scale_dialog_out);
    }
}
